package net.sunofbeach.blog.controller.user;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import net.sunofbeach.blog.mapper.RefreshTokenMapper;
import net.sunofbeach.blog.pojo.RefreshToken;
import net.sunofbeach.blog.response.Result;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Bing
 * @since 2021-11-28
 */
@RestController
@RequestMapping("/user/refreshToken")
public class RefreshTokenController {

    @Resource
    private RefreshTokenMapper refreshTokenMapper;

    /**
     * 测试
     * @param userId
     * @return
     */
    @DeleteMapping
    public Result deleteRefreshToken(String userId){
        refreshTokenMapper.delete(new QueryWrapper<RefreshToken>().in("user_id",userId));
        return Result.ok().message("删除成功");
    }

}

